package com.itheima.test3;

public class GameTest {
    public static void main(String[] args) {
        //创建对象
        Role r1 = new Role("乔峰", 100,'男');
        Role r2 = new Role("鸠摩智", 100,'男');

        //角色展示
        r1.roleShow();
        r2.roleShow();

        //开始战斗
        while (true) {
            //r1打r2
            r1.attack(r2);
            //打完一下就要判断血量，看是否被打败
            if(r2.getBlood()<=0){
                //被打败了
                System.out.println(r1.getName()+"打败了"+r2.getName());
                //跳出结束
                break;
            }
            //r2打r1
            r2.attack(r1);
            //打完一下就要判断血量，看是否被打败
            if(r1.getBlood()<=0){
                //被打败了
                System.out.println(r2.getName()+"打败了"+r1.getName());
                //跳出结束
                break;
            }
        }
    }
}
